/*
 * @Author: LVGRAPE
 * @LastEditors: LVGRAPE
 */
#ifndef __RECOGNIZE_AT32_MCU_H
#define __RECOGNIZE_AT32_MCU_H

#include <stdint.h>
#include <stdio.h>

/* at32 mcu pid/uid base address */
#define DEVICE_ID_ADDR1 0x1FFFF7F3
#define DEVICE_ID_ADDR2 0xE0042000

/* device type */
#define FALSE           0
#define AT32F403_DEVICE    403
#define AT32F413_DEVICE    413
#define AT32F415_DEVICE    415
#define AT32F403A_DEVICE   433
#define AT32F407_DEVICE    407
#define AT32F421_DEVICE    421
#define AT32F435_DEVICE    435
#define AT32F437_DEVICE    437
#define AT32F423_DEVICE    423
#define AT32F425_DEVICE    425
#define AT32A403A_DEVICE   499
#define AT32WB415_DEVICE   498


/* project id */
#define PROJECT_ID_403   0x02
#define PROJECT_ID_413   0x04
#define PROJECT_ID_415   0x05
#define PROJECT_ID_403A  0x07
#define PROJECT_ID_407   0x08
#define PROJECT_ID_421   0x09
#define PROJECT_ID_435   0x0D
#define PROJECT_ID_437   0x0E
#define PROJECT_ID_423   0x12
#define PROJECT_ID_425   0x0F
#define PROJECT_ID_A403A 0x18
#define PROJECT_ID_WB415 0x11

/* cortex type */
#define Cortex_M0       4
#define Cortex_M1       5
#define Cortex_M3       6
#define Cortex_M4       7


uint16_t recognize_id(void);
uint8_t recognize_cortex(void);
void recognize_mcu(void);

#endif
